<?php
$domain = 'http://'.$_SERVER['SERVER_NAME'];
$fileName = '/resource/test_upload.jpg';
$saveFilename = __DIR__.$fileName;

$result = [];

$file = $_FILES['file'];
move_uploaded_file($file['tmp_name'],$saveFilename);
$result['path'] = $domain.$fileName;

header("content-type:application/json");
echo json_encode($result);
?>